package com.yxw.yx_hotel.controller;

import com.yxw.yx_hotel.dto.QueryRoomReportDto;
import com.yxw.yx_hotel.dto.QueryStayReportDto;
import com.yxw.yx_hotel.service.OverviewService;
import com.yxw.yx_hotel.service.ReportService;
import com.yxw.yx_hotel.vo.*;
import com.yxw.yxnet_cd_center.common.dto.PageVO;
import com.yxw.yxnet_cd_center.common.exception.BaseException;
import com.yxw.yxnet_cd_center.common.utils.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 *  首页概览
 * @author liuxin
 * @date 2024.01.24
 */
@RestController
@Api(value = "首页概览", tags = "首页概览")
@Slf4j
@RequestMapping("/api/overview")
public class OverviewController {

    @Autowired
    private OverviewService overviewService;


    @ApiOperation(value = "客户/房源查询")
    @GetMapping("/getCustomerlistings")
    public BaseResult<CustomerlistingsVo> getCustomerlistings()  {
        CustomerlistingsVo vo=overviewService.getCustomerlistings();
        return BaseResult.doSuccess(vo,"查询成功");
    }


    @ApiOperation(value = "客户增长趋势")
    @GetMapping("/getCustomerGrowthTrend")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "queryRange", value = "查询范围  1：近七天 2：近30天", required = true)
    })
    public BaseResult<List<CustomerGrowthTrendVo>> getCustomerGrowthTrend(Integer queryRange)  {
        List<CustomerGrowthTrendVo> voList=overviewService.getCustomerGrowthTrend(queryRange);
        return BaseResult.doSuccess(voList,"查询成功");
    }

    @ApiOperation(value = "房源增长趋势")
    @GetMapping("/getRoomGrowthTrend")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "queryRange", value = "查询范围  1：近七天 2：近30天", required = true)
    })
    public BaseResult<List<RoomGrowthTrendVo>> getRoomGrowthTrend(Integer queryRange)  {
        List<RoomGrowthTrendVo> voList=overviewService.getRoomGrowthTrend(queryRange);
        return BaseResult.doSuccess(voList,"查询成功");
    }
}
